window.onload=function (){
    getNowMonthUserInfo();
}


//getTodayDeliveryList 获取当日送货清单
function getNowMonthUserInfo() {
    let nowDate = $(".main-warp").data("date")
    $.get("/nowMonthUserInfoGET", function (res) {
        console.log(res)
        if (res.data.nowMonthUserList === null) {
            alert("本月每月任何用户下达订单")
            return
        }
        let deliveryTable = document.getElementsByClassName("marketing-warp")
        deliveryTable[0].innerHTML = '' +
            '<thead><tr>' +
            '<th scope="col">用户号</th>' +
            '<th scope="col">代销处名</th>' +
            '<th scope="col">负责人</th>' +
            '<th scope="col">代销处电话</th>' +
            '<th scope="col">代销处地址</th>' +
            '</tr></thead>';
        deliveryTable[0].innerHTML += addNowMonthUserInfo(res.data.nowMonthUserList);
    })
}

function addNowMonthUserInfo(addNowMonthUserInfo) {
    let s = '<tbody>'
    for (let i = 0; i < addNowMonthUserInfo.length; ++i) {
        s += '' +
            '<tr>' +
            '<td>' + addNowMonthUserInfo[i].UserNo + '</td>' +
            '<td>' + addNowMonthUserInfo[i].ConsignmentName.String + '</td>' +
            '<td>' + addNowMonthUserInfo[i].UserName.String + '</td>' +
            '<td>' + addNowMonthUserInfo[i].ConsignmentTel.String + '</td>' +
            '<td>' + addNowMonthUserInfo[i].ConsignmentAdr.String + '</td>' +
            '</tr>';
    }
    s += '</tbody>';
    return s;
}